package com.xy.designPatterns.chainOfResponsibility;

public abstract class AbstractArticleHandler {

    private AbstractArticleHandler next;

    public void setNext(AbstractArticleHandler next) {
        this.next = next;
    }

    public void handle(Article article) {
        if (canHandle(article)) {
            doHandle(article);
        } else {
            if (next != null) {
                next.handle(article);
            }

        }
    }

    protected abstract boolean canHandle(Article article);

    protected abstract void doHandle(Article article);
}
